#ifndef SPA_QUERY_TYPES_H
#define SPA_QUERY_TYPES_H

#include <string>
#include <vector>


enum EntityType
{
	kPROCEDURE,
	kSTMTLST,
	kSTMT,
	kASSIGN,
	kCALL,
	kWHILE,
	kIF,
	kVARIABLE,
	kCONSTANT,
	kPROG_LINE
};

enum RelationType
{
	WITH,
	MODIFIES,
	MODIFIES_P, // require validator to type check to ModifiesS/ModifiesP
	MODIFIES_S, //
	USES,
	USES_P, // require validator to type check to UsesS/UsesP
	USES_S, //
	CALLS,
	CALLS_T,
	PARENT,
	PARENT_T,
	FOLLOWS,
	FOLLOWS_T,
	NEXT,
	NEXT_T,
	NEXTBIP,
	NEXTBIP_T,
	AFFECTS,
	AFFECTS_T,
	AFFECTSBIP,
	AFFECTSBIP_T,
	PATTERN, // require validator to type check to PatternA/PatternI/PatternW
	PATTERN_A, //
	PATTERN_I, //
	PATTERN_W, //
	SIBLING
};

enum ParameterType
{
	ANY, // _
	LINE, // line number
	NAME, // variable / procedure name in SIMPLE
	ENTITY, // stmt, prog_line variable names...
	BOOL,
	ATTRIBUTE, // entity.attribute
	EXPRESSION, // "x + 1"
	SUBEXPRESSION // _"x + 1"_
};

struct query_declaration
{
	EntityType type;
	std::string name;
};

struct query_parameter
{
	std::string value;
	ParameterType type;
};

struct query_relation
{
	RelationType type;
	std::vector<query_parameter> parameters;
};

struct query_tree
{
	std::vector<query_declaration> variables;
	std::vector<query_parameter> targets;
	std::vector<query_relation> relations;
};

#endif